package FinalProject



import grails.test.mixin.*

/**
 * See the API for {@link grails.test.mixin.domain.DomainClassUnitTestMixin} for usage instructions
 */
@TestFor(Game)
@Mock(Platform)
class GameTests {

    void testGame() {
        def p1 = new Platform(name: "Wii", releaseDate: "2006")
        def g1 = new Game(name: "Tatsunoko VS Capcom", releaseDate:  "2010")
        def g2 = new Game(name: "No More Heroes", releaseDate:  "2008")
        p1.addToGames(g1)
        p1.addToGames(g2)
        p1.save(failOnError: true)

        def results = Game.findByNameLike("Tatsunoko" + "%")
        assertEquals(results.platform, p1)
        assertEquals(results.name, "Tatsunoko VS Capcom")
    }
}
